import numpy as np


# Create a 1D array
array1d = np.array([1, 2, 3, 4, 5])
# get the element by index
print("access 1d array by index")
print(f"array1d[0]={array1d[0]} array1d[-1] ={array1d[-1]} ")

#create a 2D array
array2d = np.array([[1, 2, 3], [4, 5, 6],[7,8,9]])
# get the element by index
print("access 2d array by index")
print(f"array2d[0][0]={array2d[0][0]}")
print(f"array2d[1][1]={array2d[1][1]}")
print(f"array2d[2][0]={array2d[2][0]}")
print(f"array2d[-1][-1]={array2d[-1][-1]}")

#create a 3d array
array3d= np.array([
    [
        [0,1,3],
        [4,5,6],
    ],
    [
        [7,8,9],
        [10,11,12],
    ],
    [
        [13,14,15],
        [16,17,18],
    ],
    
    ])

print("access 3d data")
print(f"array3d={array3d}")
print("access array3d by index")

print(f"array3d[0][0][0]={array3d[0][0][0]}")
print(f"array3d[2][0][0]={array3d[2][0][0]}")
print(f"array3d[-2][-1][1]={array3d[-2][-1][1]}")
